<?php if (isset($add)) echo "<h2>Thêm Danh mục</h2>"; else echo "<h2>Thay đổi thông tin danh mục</h2>";?>
<form name="edit_tour" action="?act=createOrModifyCategory&category_id=<?php if (isset($category_id)) echo $category_id ?>" method="POST" onsubmit="return validate_values()" enctype="multipart/form-data">
	<div class='row_field'>
    	<div class='label'>
			<label for="category_name">Tên danh mục(*):</label>
        </div>
        <div class='field'>
			<input type="text" class='inputbox' id="category_name" name="category_name" value="<?php if (isset($category)) echo $category->getname()?>">
        </div>
	</div>
	
	<div class='row_field'>
    	<div class='label'>
			<label for="category_description">Miêu tả danh mục:</label>
        </div>
        <div style='clear:both'></div>
    </div>
    <div class='row_field'>
		<?php
		include("../fckeditor.php");
		$sBasePath = $_SERVER['PHP_SELF'] ;
		$sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "admin" ) ) ;
		
		$oFCKeditor = new FCKeditor('category_description') ;
		$oFCKeditor->BasePath	= $sBasePath ;
		$oFCKeditor->Value		= ($category)?$category->getdescription():"";
		$oFCKeditor->Height		= 300;
		$oFCKeditor->Create() ;
		?>
	</div>
    
	<div class='row_field'><p>(*) Thông tin bắt buộc</p></div>
	<div class='row_field'>
    	<input type='reset' value='Reset' class='button' />
		<input type="submit" value="Save" class='button' />
	</div>
	
</form>
<script type="text/javascript">
	function validate_values() {
		name = $('#category_name').val();
		
		message = "Các mục sau đây là bắt buộc hoặc sai giá trị: \n";
		ok = true;
		if (name == "") {
			message += "Tên danh mục \n";
			ok = false;
		}
		if (!ok) alert(message);
		return ok;
	}
</script>